import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';
import { UserRole, UserStatus, UserLanguage, UserTheme, UserNavigation } from '../enums/user.enum';

@Entity()
export class User {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ unique: true })
  username: string;

  @Column({ unique: true })
  email: string;

  @Column({ nullable: true, unique: true })
  phone: string;

  @Column()
  password: string;

  @Column({
    type: 'enum',
    enum: UserRole,
    default: UserRole.USER,
  })
  role: UserRole;

  @Column({
    type: 'enum',
    enum: UserStatus,
    default: UserStatus.ENABLED,
  })
  status: UserStatus;

  @Column({ nullable: true })
  avatar: string;

  @Column({
    type: 'enum',
    enum: UserLanguage,
    default: UserLanguage.ZH,
  })
  language: UserLanguage;

  @Column({
    type: 'enum',
    enum: UserTheme,
    default: UserTheme.MODAL,
  })
  theme: UserTheme;

  @Column({
    type: 'enum',
    enum: UserNavigation,
    default: UserNavigation.SIDE,
  })
  navigation: UserNavigation;

  @CreateDateColumn()
  createdAt: Date;

  @UpdateDateColumn()
  updatedAt: Date;
} 